//
//  UIBarButtonItem + Extension.swift
//  WeiboSwift
//
//  Created by Apple13 on 16/7/9.
//  Copyright © 2016年 yupeng. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    
    convenience init(title:String,target: AnyObject?,action:Selector) {
        self.init()
        
        let button = UIButton()
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        
        //设置文字和颜色
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        
        //设置字体大小
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        button.sizeToFit()
        
        //设置customView
        customView = button
    }
    
    
    
}
